/*
 * Copyright 2014 HarryKim.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package opera.constants;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
import org.slf4j.LoggerFactory;

/**
 *
 * @author HarryKim
 */
public class DatabaseConstants {

    private static final org.slf4j.Logger Log = LoggerFactory.getLogger(DatabaseConstants.class);

    public static String DB_URL;
    public static String DB_USER;
    public static String DB_PASSWORD;

    public static void load() {
        Properties props = null;
        try (FileReader fr = new FileReader("data/db.properties")) {
            props = new Properties();
            props.load(fr);
            DB_URL = props.getProperty("database.url");
            DB_USER = props.getProperty("database.user");
            DB_PASSWORD = props.getProperty("database.password");
        } catch (FileNotFoundException ex) {
            Log.error(null, ex);
        } catch (IOException ex) {
            Log.error(null, ex);
        }
    }
    
}
